package image;

import javafx.scene.Node;
import javafx.scene.paint.Color;
import javafx.scene.paint.Paint;

/**
 * A class that allows drawing and manipulating of a rectangle
 * @author Etienne Bruines
 * @author Bas Dobbelsteen
 */
public class Rectangle extends Layer
{
	private javafx.scene.shape.Rectangle content;
	
	public Rectangle(String t, Paint foreColor, Paint backColor, double strokeWidth, double x, double y, double width, double height)
	{
		super(t);
		
		content = new javafx.scene.shape.Rectangle(x, y, width, height);
		content.setFill(backColor);
		content.setStroke(foreColor);
		content.setStrokeWidth(strokeWidth);
		
		super.setBinding();
	}
	
	@Override public Node getContent()
	{
		return content;
	}

	@Override public int getWidth()
	{
		return (int) content.getWidth();
	}

	@Override public int getHeight()
	{
		return (int) content.getHeight();
	}

	@Override public int getX()
	{
		return (int) content.getX();
	}

	@Override public int getY()
	{
		return (int) content.getY();
	}

	@Override public void setBorder(Color c)
	{
		this.content.setStroke(c);
	}

	@Override public void setBackground(Color c)
	{
		this.content.setFill(c);
	}

	@Override public void setStroke(double width)
	{
		this.content.setStrokeWidth(width);
	}
	
}
